<!doctype html>
<html lang="en" xmlns:v-bind="http://www.w3.org/1999/xhtml" xmlns:v-on="http://www.w3.org/1999/xhtml" xmlns:v-model="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <link rel="stylesheet" href="../../vender/animate@3.5.0.min.css">
</head>
<body>
<pre>
    可以通过 appear 特性设置节点的在初始渲染的过渡
</pre>
<div id="app">

    <my-component></my-component>
</div>


</body>
<script src="../../vender/vue@2.4.2.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/velocity/1.2.3/velocity.min.js"></script>

<script>
    var app=new Vue({
        el:'#app',
        components:{
            myComponent:{
                template:`<div>
                    <button @click="show=!show">Toggle</button>
                    <transition
  appear
  appear-class="custom-appear-class"
  appear-to-class="custom-appear-to-class"
  appear-active-class="custom-appear-active-class"
>
                        <p v-if="show">show:{{show}}</p>
                    </transition>
                </div>`,
                data:function(){
                    return {
                        show:true
                    }
                },
                methods:{
                    beforeEnter: function (el) {
                        console.log('进入前');
                        el.style.opacity=0;
                        el.style.transformOrigin='left';
                    },
                    enter: function (el, done) {
                        console.log('进入中');
                        Velocity(el,{opacity:1,fontSize:'1.4em'},{duration:300});
                        Velocity(el,{fontSize:'1em'},{complete:done});
                    },


                    leave: function (el, done) {
                        console.log('离开中');
                        Velocity(el,{translateX:'15px',rotateZ:'50deg'},{duration:600});
                        Velocity(el,{rotateZ:'100deg'},{loop:2});
                        Velocity(el,{rotateZ:'45deg',translateY:'30px',translateX:'30px',opacity:0},{complete:done});
                    }
                }
            }
        }
    });



</script>
</html>